package com.woniuxy.controller;

import com.github.pagehelper.PageInfo;
import com.woniuxy.entity.Manager;
import com.woniuxy.entity.ManagerDto;
import com.woniuxy.entity.Perm;
import com.woniuxy.entity.PermDto;
import com.woniuxy.service.ManagerService;
import com.woniuxy.service.PermService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Description: TODO(用一句话描述这个类的作用)
 * @Author 18452
 * @Date 2021/4/27 10:33
 */
@Controller
@CrossOrigin
@RequestMapping("/manager")
public class ManagerController {

    @Autowired
    ManagerService managerService;

    @RequestMapping("/select")
    @ResponseBody
    public PageInfo<Map<String, String>> select(@RequestBody ManagerDto managerDto){
        System.out.println("-------"+managerDto);
        PageInfo<Map<String, String>> mapPageInfo = managerService.select(managerDto);
        return mapPageInfo;
    }
    @RequestMapping("/insert")
    @ResponseBody
    public String insert(@RequestBody Manager manager){
        System.out.println("-------"+manager);
        String result = managerService.insert(manager);
        return result;
    }
    @RequestMapping("/update")
    @ResponseBody
    public String update(@RequestBody Manager manager){
        System.out.println("-------"+manager);
        String result = managerService.update(manager);
        return result;
    }
    @RequestMapping("/delete")
    @ResponseBody
    public String delete(int id){
        String result = managerService.delete(id);
        return result;
    }
}

